package edu.webarchitechture.bank.ejb3.services;

import org.hibernate.Session;
import org.hibernate.Criteria;
import edu.webarchitechture.bank.ejb3.domain.Account;

import java.util.Arrays;
import java.util.List;

/**
 * Data access class to access account related information.
 *
 * @author Inoka Dissanayaka
 */
public class AccountManagerDAO {

    Session session;

    public AccountManagerDAO(Session session) {
        this.session = session;
    }

    public void addCustomerToAccount(Long customerId, Long accountId) {

    }

    public Long createAccount(Account account, Long customerId) {
        return null;
    }

    public List<Account> getAccountsOfCustomer(Long customerId) {
        return session.createCriteria(Account.class).list();
    }

    public List<Long> getCustomerIds(Long accountId) {
        return null;
    }

    public Account getAccount(Long accountId) {
        return (Account) session.get(Account.class, accountId);
    }

    public void removeAccount() {

    }

    public void removeCustomerFromAccount(Long customerId, Long accountId) {

    }
    
    public List<Account> getServiceAccounts()
    {
    	return Arrays.asList(new Account());
    }
    
    public boolean validateAccount(Long accNo)
    {
    	return true;
    }
}
